#include "ticker.h"
#include "stm32f0xx_conf.h"

static Ticker g_ticker;


void Ticker_Init(void)
{
	g_ticker.counter = 0;
	g_ticker.current = 0;
	g_ticker.interval = 1000;
	SysTick_Config(SystemCoreClock / 1000);
}

void SysTick_Handler(void)
{
  if( ++g_ticker.counter >= g_ticker.interval )
  {
	  g_ticker.counter = 0;
  }
  g_ticker.current++;
}
unsigned long Ticker_Get(void)
{
	return g_ticker.current;
}
